package com.service;

import java.util.List;

import com.dao.CommentDao;
import com.dao.TrendDao;
import com.entity.Comment;
import com.entity.Trend;
import com.entity.TrendUserProject;
import com.util.PageHelp;

public class TrendService {
	private TrendDao td=new TrendDao();
	private CommentDao cd=new CommentDao();
	public PageHelp<Trend> findTrendByPage(int pageNum) {
		PageHelp<Trend> page=new PageHelp<Trend>(5,td.getCount(),pageNum);
		return td.findByPage(page);
	}
	public void saveFromTrend(Comment c) {
		// TODO Auto-generated method stub
		cd.save(c);
	}
	public void saveTrend(Trend t) {
		// TODO Auto-generated method stub
		
		td.saveTrend(t);
	}
	
	public List<Comment> findComment(String trendid) {
		// TODO Auto-generated method stub
		return cd.findByTrendid(trendid);
	}
	public void saveTrendOther(String trendid, String trendContent,
			String trendTime, String userid, String projectid) {
		// TODO Auto-generated method stub
		Trend t=new Trend();
		t.setContent(trendContent);
		t.setCreateTime(trendTime);
		t.setId(trendid);
		t.setProjectid(projectid);
		t.setUserid(userid);
		
		td.saveTrend(t);
	}
	
}
